﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

public partial class qqEvent : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {

    }
protected void LinkButton1_Click(object sender, EventArgs e)
{
    cn.com.webxml.webservice.qqOnlineWebService service
        = new cn.com.webxml.webservice.qqOnlineWebService();

    service.qqCheckOnlineCompleted 
        += new cn.com.webxml.webservice.qqCheckOnlineCompletedEventHandler(service_qqCheckOnlineCompleted);
        
    string qq = this.TextBox1.Text;
        
    DateTime begin = DateTime.Now;
    this.Context.Items["Begin"] = begin;

    service.qqCheckOnlineAsync( qq );

}

void service_qqCheckOnlineCompleted(object sender, cn.com.webxml.webservice.qqCheckOnlineCompletedEventArgs e)
{

    DateTime begin = (DateTime)this.Context.Items["Begin"];
    DateTime end = DateTime.Now;
    TimeSpan span = end - begin;

    string code = e.Result;

    this.Label1.Text = QQOnlineHelper.GetOnlineStatus(code);
    this.Label2.Text = string.Format("请求共花费：{0} 毫秒。", span.TotalMilliseconds);


}
}